#ifndef SONG_H
#define SONG_H

#include "obstacle.h"

#include <vector>
#include <string>

class Song
{
public:

	class Iterator
	{
	public:
		static Song::Iterator end();

		Iterator();
		Iterator(Song::Iterator & other);
		Iterator(const Song * const song, int time);

		void setPosition(int time);
		int getPosition() const;

		Song::Iterator & operator ++();
		Obstacle * operator *() const;

		bool operator ==(Song::Iterator & rhs);
		bool operator !=(Song::Iterator & rhs);

	private:
		const Song * song;
		int time;
		bool endTag;
		std::vector<Obstacle*>::const_iterator it;
	};

	Song();
	Song(int duration);
	Song(std::string & filePath);
	~Song();

	void addObstacle(Obstacle::Type type, int size1, int size2, int time, int duration);
	void sortObstacles();

	int getObstacleCount() const;
	int getDuration() const;

	Song::Iterator obstaclesFrom(int time) const;
	Song::Iterator endIterator() const;

private:
	std::vector<Obstacle*> obstacles;
	int duration; // in milliseconds
};

#endif // SONG_H
